|
|
 |
|
|
|
|
Dim dReaC As Double
Dim dImaC As Double
Dim ReaZ As Double
Dim ImaZ As Double
Dim ReaZ2 As Double
Dim ImaZ2 As Double
Dim r As Integer
Dim b As Integer
Dim g As Integer
picCanvas.Line (0, 0)-(picCanvas.ScaleWidth, _
picCanvas.ScaleHeight), vbBlack, BF
DoEvents
' Get the image's pixels. GetBitmapPixels picCanvas, pixels, bits_per_pixel
' Adjust the coordinate bounds to fit picCanvas. AdjustAspect
' dReaC is the change in the real part
' (X value) for C. dImaC is the change in the
' imaginary part (Y value). wid = picCanvas.ScaleWidth
hgt = picCanvas.ScaleHeight
dReaC = (m_Xmax - m_Xmin) / (wid - 1)
dImaC = (m_Ymax - m_Ymin) / (hgt - 1)
' Calculate the values. ReaC = m_Xmin
For i = 0 To wid - 1
ImaC = m_Ymin
For j = 0 To hgt - 1
ReaZ = 0
ImaZ = 0
ReaZ2 = 0
ImaZ2 = 0
clr = 1
Do While clr < MaxMandelbrotIterations And _
ReaZ2 + ImaZ2 < MAX_MAG_SQUARED ' Calculate Z(clr). ReaZ2 = ReaZ * ReaZ
ImaZ2 = ImaZ * ImaZ
ImaZ = 2 * ImaZ * ReaZ + ImaC
ReaZ = ReaZ2 - ImaZ2 + ReaC
clr = clr + 1
Loop
clr = m_Colors(1 + clr Mod NumColors)
With pixels(i, j)
.rgbRed = clr And &HFF& |
|
|
|
|
|